<?php
	if ($_POST) {
		// var_dump($_POST["username"]);//传过来的是一个数组，不能拿echo输出
		$username = empty($_POST["username"]) ? false:$_POST["username"];
		if(!$username){
			var_dump("请输入用户名");
		}
		$userData = include './user.php';

		foreach ($userData as $value) {
			if(in_array($username, $value)){
				$user = $value;
			}
		}
		if(isset($user)){
			$arr = array(
				      'error' => 1, 
				      'msg' =>"用户名正确",
				   ); //数组后边要加;
		}else{
			$arr = array(
                      'error' =>0,
                      'msg' =>"用户名不争确",
				   );
		}
		echo json_encode($arr);
	}

?>